/*
 * @Author: liangliang
 * @Date: 2023-05-22 18:47:50
 * @LastEditors: yusha
 * @LastEditTime: 2023-08-25 10:07:39
 * @Description: 新增/修改供应商信息
 */
import dayjs from 'dayjs';
import { Form, Input, InputNumber, Select, DatePicker } from 'antd';
import { useMount } from 'ahooks';
import './index.scss';

const EditSupplierInfo = (props: any) => {
    const { formModal, rowItem } = props;
    const { modal, form } = formModal;

    useMount(() => {
        const { bugTime, ...rest } = rowItem;
        form.setFieldsValue({
            bugTime: dayjs(bugTime),
            ...rest,
            // stageSettleType: rowItem?.stageSettleType ? rowItem?.stageSettleType : undefined
        });
    });
    return (
        <>
            <Form name="editSupplierInfo" labelCol={{ span: 6 }} wrapperCol={{ span: 18 }} form={form}>
                <div>
                    {/* <h2 className="base-info-style">线上故障登记</h2> */}
                    <Form.Item label="故障类型" name="bugType" rules={[{ required: true, message: '请选择' }]}>
                        <Select
                            placeholder="选择故障类型"
                            options={[
                                { value: '技术自查', label: '技术自查' },
                                { value: '业务反馈', label: '业务反馈' },
                                { value: '数据监控', label: '数据监控' },
                                { value: '接口自动化', label: '接口自动化' },
                                { value: '其他', label: '其他' },
                            ]}
                        />
                    </Form.Item>
                    <Form.Item label="所属应用" name="belongApplication" rules={[{ required: true, message: '请选择' }]}>
                        <Select
                            placeholder="选择故障所属应用，前端问题选择前端"
                            options={[
                                { value: '订单', label: '订单' },
                                { value: '采购', label: '采购' },
                                { value: '仓库', label: '仓库' },
                                { value: '商品', label: '商品' },
                                { value: '结算', label: '结算' },
                                { value: 'api', label: 'api' },
                                { value: '营销', label: '营销' },
                                { value: '会员', label: '会员' },
                                { value: '前端', label: '前端' },
                                { value: '其他', label: '其他' },
                            ]}
                        />
                    </Form.Item>
                    <Form.Item label="故障等级" name="bugLevel" rules={[{ required: true, message: '请选择' }]}>
                        <Select
                            placeholder="按照故障定级标准选择，暂时不能定义的，选择P3"
                            options={[
                                { value: '待定级', label: '待定级' },
                                { value: 'P0', label: 'P0' },
                                { value: 'P1', label: 'P1' },
                                { value: 'P2', label: 'P2' },
                                { value: 'P3', label: 'P3' },
                                { value: 'P4', label: 'P4' },
                                { value: 'P5', label: 'P5' },
                            ]}
                        />
                    </Form.Item>
                    <Form.Item label="故障状态" name="bugStatus" rules={[{ required: true, message: '请选择' }]}>
                        <Select
                            placeholder="当前故障处理进度选择状态"
                            options={[
                                { value: '待处理', label: '待处理' },
                                { value: '已解决', label: '已解决' },
                                { value: '转产品', label: '转产品' },
                                { value: '处理中', label: '处理中' },
                            ]}
                        />
                    </Form.Item>
                    <Form.Item label="故障时间" name="bugTime" rules={[{ required: true }]}>
                        <DatePicker style={{ width: '100%' }} />
                    </Form.Item>
                    <Form.Item label="故障描述" name="bugDescribe" rules={[{ required: true, message: '请输入' }]}>
                        <Input.TextArea rows={3} placeholder="故障描述，言简意赅，清晰明了，资损故障明确影响面" />
                    </Form.Item>
                    <Form.Item label="故障原因" name="bugReason" rules={[{ required: true, message: '请输入' }]}>
                        <Input.TextArea rows={3} placeholder="故障发生的真实原因" />
                    </Form.Item>
                    <Form.Item label="故障跟进人" name="bugFlower" rules={[{ required: true, message: '请输入' }]}>
                        <Input placeholder="填写本次故障修复人跟进人信息" />
                    </Form.Item>
                    <Form.Item label="关联项目" name="linkProject" rules={[{ required: true, message: '请输入' }]}>
                        <Input placeholder="实际关联项目，如果是历史问题填：历史故障" />
                    </Form.Item>
                    <Form.Item label="开发人员" name="developer" rules={[{ required: false, message: '请输入' }]}>
                        <Input placeholder="关联项目的实际开发人员" />
                    </Form.Item>
                    <Form.Item label="测试人员" name="tester" rules={[{ required: false, message: '请输入' }]}>
                        <Input placeholder="关联项目的实际测试人员" />
                    </Form.Item>
                    <Form.Item label="云效链接" name="yunxiaoLink" rules={[{ required: false, message: '请输入' }]}>
                        <Input placeholder="请输入" />
                    </Form.Item>
                    <Form.Item label="自动化是否覆盖" name="autoCheckFlag" rules={[{ required: true, message: '请选择' }]}>
                        <Select
                            placeholder="请选择"
                            options={[
                                { value: '已覆盖', label: '已覆盖' },
                                { value: '未覆盖', label: '未覆盖' },
                                { value: '难以覆盖', label: '难以覆盖' },
                            ]}
                        />
                    </Form.Item>
                    <Form.Item label="备注" name="remark" >
                        <Input.TextArea rows={3} placeholder="备注故障其他信息，复杂故障可以举例说明" />
                    </Form.Item>
                </div>
            </Form>
        </>
    );
};

export default EditSupplierInfo;
